<template>
  <!-- 添加或修改项目基础信息管理对话框 -->
  <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body v-dialogDrag width="90%">
     <el-table :data="columns" v-loading="loading">
      <el-table-column label="请购单号" align="center" prop="lvdoNo"/>
      <el-table-column label="框架编号" align="center" prop="order.projectCode"/>
      <el-table-column label="订单编号" align="center" prop="projectNo"/>
      <el-table-column label="创建日期" align="center" prop="createTime"/>
      <el-table-column label="工程名称" align="center" prop="gongchengName"/>
      <el-table-column label="产品编码" align="center" prop="goodsCode">
        <template slot-scope="scope">
            <span>{{ scope.row.goodsCode }}</span>
        </template>
      </el-table-column>
      <el-table-column label="产品状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.goods_status" :value="scope.row.status" />
        </template>
      </el-table-column>
      <el-table-column align="center" label="产品名称" prop="goodsName"/>
      <el-table-column align="center" label="合同物料名称" prop="contractGoodsName"/>
      <el-table-column align="center" label="合同收货人" prop="deliveryPerson"/>
      <el-table-column align="center" label="产品型号" prop="model"/>
      <el-table-column align="center" label="产品单位" prop="unit"/>
      <el-table-column align="center" label="销售单价" prop="goodsUnitPrice"/>
      <el-table-column align="center" label="销售总价" prop="goodsTotalPrice"/>
      <el-table-column align="center" label="业务员" prop="order.salesmanName"/>
      <el-table-column align="center" label="制单人" prop="order.createName"/>
      <el-table-column align="center" label="订单数量" prop="orderCount"/>
      <el-table-column align="center" label="锁定数量" prop="lockCount"/>
      <el-table-column label="是否自制" align="center" prop="isdo">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.isdo" :value="scope.row.isdo"/>
        </template>
      </el-table-column>
      <el-table-column align="center" label="自制/请购数量" prop="pleaseBuyCount"/>
      <el-table-column align="center" label="备注" prop="remark"/>
    </el-table>
    <div class="dialog-footer" slot="footer">
      <el-button @click="cancel">取 消</el-button>
    </div>
    
  </el-dialog>
</template>

<script>
  import {deleteAction, downloadFile, getAction,getById} from '@/api/manage'

export default {
  name: "ContractualGoods",
  dicts: ['isdo','sale_state','goods_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      activeName: "first",
      // 弹出层标题
      title: "所属销售订单产品",
      // 是否显示弹出层
      open: false,
      // 显示搜索条件
      showSearch: true,
      // 表单参数
      form: {},
      proId: "",
      proStatus: "",
      columns: [],
      total: 0,
      // 表单校验
      rules: {
      },
      queryParams: {
        pageNum: 1,
        pageSize: 1000,
        id: null,
        code: null,
        projectNo: null,
        goodsName: null,
        goodsCode: null,
        goodsModel: null,
        model: null,
        brand: null,
        isdo: null,
        remark: null,
        projectId: null,
        //orderByColumn:"isdo",
        isAsc:"desc"
      },
      url: {
        list: '/goodsSale/goodsSale/',
        getById: '/projectBaseInfo/projectBaseInfo/',
      },
    };
  },
  created() {
    // this.handleQuery();
  },
  methods: {
    ContractualGoodsOpens(row){
      this.open = true;
      this.queryParams.id = row.goodsSaleId;
      this.getList();
    },
    getList(row) {
      this.loading = true;
      getById(this.url.list, this.queryParams.id).then(response => {
        this.columns = [response.data];
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    reset() {
      this.form = {
        id: null,
        goodsName: null,
        goodsCode: null,
        goodsModel: null,
      };
      this.resetForm("form");
    },
    /*handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      this.proId = id;
      this.proStatus = row.status;
      getById(this.url.getById, id).then(response => {
        this.open = true;
        this.title = "修改订单基础信息管理";
        this.getList();
      });
    },*/
  }
};
</script>
